package com.pororo.smartoff;

import android.app.Service;
import android.content.Context;
import android.content.SharedPreferences;

public class SmartOffPreferences {
	
	private static SharedPreferences preferences = null;
	private static SharedPreferences.Editor editor = null;
	
	static public void setPreferences(Context context) {
		if ( preferences == null ) {
			preferences = context.getSharedPreferences("ScreenOffPreferences", Service.MODE_PRIVATE);
			editor = preferences.edit();
		}
	}
	
	static public void initialize(Context context) {
		preferences = context.getSharedPreferences("ScreenOffPreferences", Service.MODE_PRIVATE);
		editor = preferences.edit();
		
		
		
		editor.commit();
	}
	
	static public boolean checkInitialization() {
		return preferences != null;
	}
	
	static public boolean getBoolean(String key) {
		return preferences.getBoolean(key, false);
	}
	
	static public String getString(String key) {
		return preferences.getString(key, null);
	}
	
	static public int getInt(String key) {
		return preferences.getInt(key, -1);
	}
	
	static public void setBoolean(String key, boolean value) {
		editor.putBoolean(key, value);
		editor.commit();
	}
	
	static public void setString(String key, String value) {
		editor.putString(key, value);
		editor.commit();
	}
	
	static public void setInt(String key, int value) {
		editor.putInt(key, value);
		editor.commit();
	}
	
	


}
